#include <Wire.h>
#include <AHT20.h>

#define TCA9548A_ADDR 0x70

AHT20 aht;

void TCA9548A(uint8_t bus){
  Wire.beginTransmission(TCA9548A_ADDR);  // TCA9548A address
  Wire.write(1 << bus);          // send byte to select bus
  Wire.endTransmission();
  Serial.print(bus);
}

void setup() {
  Serial.begin(9600);
  Serial.println("Humidity AHT20 examples");
  Wire.begin();
  TCA9548A(0);
  aht.begin();
}

void loop() {
  float temp = aht.getTemperature();
  float hum = aht.getHumidity();

  Serial.print("Temperature: ");
  Serial.print(temp);
  Serial.println(" *C");

  Serial.print("Humidity: ");
  Serial.print(hum);
  Serial.println(" %");

  delay(1000);
}